const Controller = require('../core/base_controller');


class AppController extends Controller {
    async page() {
        let ret = await this.service.visit.page(this.param)
        this.success(ret)
    }

    async save() {
        const { app } = this
        let ret = await app.table('visit').save(this.param)

        let fee_list = this.param.visit_fees
        for (let li of fee_list) {
            li.visit_id = ret.id
            app.table('visit_fee').save(li)
        }

        this.success(ret)
    }

    async remove() {
        const { app } = this
        let ret = app.table('visit').delete(this.param)
        this.success(ret)
    }
}
module.exports = AppController;
